﻿using NetworkLib.Utilities;
using PBO.Network.Enumerations;
using System;
using System.Collections.Generic;

namespace PBO.Network.Domain
{
    public class PlayerMove : DataByteArray
    {
        public string Player { get; set; }
        public BattleMove Move { get; set; }
        public PokemonIndex Pokemon { get; set; }
        public TargetIndex Target { get; set; }
        public byte MoveIndex { get; set; }

        #region abstract

        public override void Read(ByteArray byteArray)
        {
            this.Player = byteArray.ReadUTF();
            this.Move = (BattleMove)byteArray.ReadInt();
            this.Pokemon = (PokemonIndex)byteArray.ReadInt();
            this.Target = (TargetIndex)byteArray.ReadInt();
            this.MoveIndex = byteArray.ReadByte();
        }

        public override void Write(ByteArray byteArray)
        {
            byteArray.WriteUTF(this.Player);
            byteArray.WriteInt((int)this.Move);
            byteArray.WriteInt((int)this.Pokemon);
            byteArray.WriteInt((int)this.Target);
            byteArray.WriteByte(this.MoveIndex);
        }

        #endregion

    }
}
